package com.mall.model.vo;

import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mall.model.domain.OmsOrder;
import com.mall.model.domain.OmsOrderItem;
import com.mall.model.domain.OmsOrderOperateHistory;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author : xyiaao
 * @createDate : 2022/4/2 14:29
 */
@NoArgsConstructor
@Data
public class OmsOrderDetailVo extends OmsOrder {

    /**
     * 订单操作记录
     */
    @JsonProperty("historyList")
    private List<OmsOrderOperateHistory> omsOrderOperateHistoryList;


    /**
     * 订单商品列表
     */
    @JsonProperty("orderItemList")
    private List<OmsOrderItem> omsOrderItemList;


    public static OmsOrderDetailVo init(OmsOrder omsOrder, List<OmsOrderOperateHistory> omsOrderOperateHistoryList, List<OmsOrderItem> omsOrderItemList) {

        OmsOrderDetailVo omsOrderDetailVo = new OmsOrderDetailVo();
        BeanUtil.copyProperties(omsOrder, omsOrderDetailVo);
        omsOrderDetailVo.setOmsOrderOperateHistoryList(omsOrderOperateHistoryList);
        omsOrderDetailVo.setOmsOrderItemList(omsOrderItemList);
        return omsOrderDetailVo;
    }

}
